﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminSite.Master" Inherits="System.Web.Mvc.ViewPage<List<MensUnoShop.Models.OrderData>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	OrderShippingnumChange
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<script type="text/javascript" language="javascript">
    function OrderShippingnumChange(batchid, oguid) {
        var shipno = $("#shipno").val();
        var jsonstring = { "oguid": oguid, "shippingnum": shipno };
        $.ajax({
            type: "POST",
            traditional: true,
            url: "/Admin/OrderManagement/OrderShippingnumChange",
            data: jsonstring,
            dataType: "json",
            success: function (data) {
                if (data.code == "200") {
                    alert("出貨單號修改成功!");
                    location.href = '/Admin/OrderManagement/OrderShipBatchDetail/' + batchid;
                    //$("#tr_" + oguid).remove();
                }
                else
                    alert(data.response);
            }
        });
    }
    $(document).ready(function () {
        $("a#OrderDetail").fancybox();
        $("a#MemberDetail").fancybox();

    });
</script>
<div style="overflow:scroll;">
    <table>
        <thead>
        	<tr>                
                <th style="width:100px">批次編號</th>           
                <th style="width:100px">訂單編號</th>
                <th style="width:100px">金流編號</th>
                <th style="width:100px">訂單金額</th>
                <th style="width:100px">會員帳號</th>
                <th style="width:100px">會員姓名</th>
                <th style="width:100px">請輸入出貨單號</th>
                <th style="width:100px"></th>
                <th style="width:100px"></th>
            </tr>            
        </thead>        
        
        <%if (Model != null)
            {%>           
        <tbody>
            <%foreach (var item in Model)
            {  %>
        	<tr>                    
                <th><%:item.OBBATCHID %></th>
                <th><%:item.OTXID %></th>
                <th><%:item.OCASHID %></th>
                <th><%:item.ORDERPRICE %></th>
                <th><%:item.MEMAIL %></th>
                <th><%:item.MNAME %></th>                
                <th>
                <input type="text" id="shipno" name="shipno" value="<%:item.OSHIPPINGNUM %>"/>
                <input type="button" name="changeordership" id="changeordership" value="確認修改出貨單號" onclick="javascript:OrderShippingnumChange(<%:item.OBBATCHID %>,'<%:item.OGUID %>');" />
                </th>
                <th><a id="OrderDetail" name="OrderDetail" class="iframe" href="../OrderDetailView/<%:item.OGUID %>">訂單明細</a></th>
                <th><a id="MemberDetail" name="MemberDetail" class="iframe" href="/Admin/MemberManagement/MemberDetailView/<%:item.MGUID %>">會員資料</a></th>                
            </tr>
            <%} %>
        </tbody>
        <%} %>
    </table>
</div>

</asp:Content>
